const Router = require('@koa/router')
const { server } = require('../env')
const auth = require('../middleware/auth')
const { verifyLogin, verifyRegister } = require('../middleware/user.middleware')
const userController = require('../controller/user.controller')

const userRouter = new Router({ prefix: `${server.pathPrefix}/user` })

userRouter.post('/login', verifyLogin, userController.login) // 用户登录
userRouter.post('/register', verifyRegister, userController.register) // 用户注册
userRouter.get('/', auth, userController.getInfo) // 获取个人信息

module.exports = userRouter